<?php

namespace App\Http\Requests;

use Illuminate\Support\Arr;

class ReportRequest extends FormRequest
{
    public function rules()
    {
        $id = (int) optional($this->route('report'))->id;
        $rules = [
            'type' => 'required',
            'content'=>'required',
            'edit_type'=>'required'
        ];
        if ($this->isMethod('put')) {
            $rules = Arr::only($rules, $this->keys());
        }
        return $rules;
    }

    public function messages()
    {
        return [
            //
        ];
    }

    public function attributes()
    {
        return [
            'id' => '经营报备id',
        ];
    }
}
